<template>
  <div>
    <!-- 收藏 返回 -->
    <div>
      <van-nav-bar
        title="收藏"
        left-text="返回"
        left-arrow
        @click-left="$router.go(-1)"
        type="primary"
      />
    </div>
    <!-- 表单 -->
    <van-list
      v-model="loading"
      :finished="finished"
      finished-text="没有更多了"
      @load="onLoad"
    >
      <!-- <div class="dahezi">
        <div class="zfd">
          <img :src="list" alt="" />
        </div>
        <div class="yfd">
          <h3 class="">{{ ffss }}</h3>
          <div>{{ aa }}</div>
          <div></div>
          <div></div>
        </div>
      </div> -->
      <AleiBiao v-for="item in list" :key="item.id" :item="item"><AleiBiao/>
      <van-cell v-for="item in list" :key="item" :title="item" />
    </van-list>
  </div>
</template>

<script>
import AleiBiao from '@/components/Alei-Biao.vue'
import { getFavorites } from '@/api/article'
export default {
  components: {
    AleiBiao
  },
  data () {
    return {
      list: [],
      loading: false,
      finished: false,
      page: 1
    }
  },
  methods: {
    async onLoad () {
      const res = await getFavorites()
      // page: this.page
      // this.list = res
      console.log(res)
      // 异步更新数据
      // setTimeout 仅做示例，真实场景中一般为 ajax 请求
      setTimeout(() => {
        for (let i = 0; i < 10; i++) {
          this.list.push(this.list.length + 1)
        }

        // 加载状态结束
        this.loading = false

        // 数据全部加载完成
        if (this.list.length >= 40) {
          this.finished = true
        }
      }, 1000)
    }
  }
  // methods: {},
  // async created () {
  //   const res = await getFavorites()
  //   console.log(res)
  // }
}
</script>

<style lang="less" secped>
// .dahezi {
//   height: 120px;
//   // background-color: #000;
//   border: 1px solid #000;
//   img {
//     width: 100px;
//     height: 100px;
//   }
// }
</style>
